package pool;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.SynchronousQueue;


public final class QueueFactory{
    
    private QueueFactory() {
    }
    
    public static <T> BlockingQueue<T> getInstance(int maxSize) {
        if(maxSize == 0)
            return new SynchronousQueue<T>();
        else if(maxSize > 0)
            return new ArrayBlockingQueue<T>(maxSize);
        else
            return new LinkedTransferQueue<T>();
    }
}
